home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software of the Month Club 1996 June
/
Software of the Month Club 1996 June.iso
/
mac
/
ISO9660
/
DOS
/
DTP
/
AURORA
/
DELDUP.AML
< prev
next >
Wrap
Text File
|
1995-02-24
|
2KB
|
68 lines
// ───────────────────────────────────────────────────────────────────
// The Aurora Editor v2.0
// Copyright 1993-1995 nuText Systems. All Rights Reserved Worldwide.
//
// Delete duplicate lines
//
// This macro deletes contiguous duplicate lines in the current edit
// window. The total number of lines removed is displayed.
//
// (Note: this macro will run faster if undo is disabled)
// ───────────────────────────────────────────────────────────────────
include bootpath "define.aml"
var lastline
var shownext
// test for edit windows
if not wintype? "edit" then
msgbox "Edit windows only!"
return
end
oldsize = getlines // save the number of lines in file
undobegin // group this together as one undoable action
row 1 // goto the first line
lasttext = gettext // get first line in variable lasttext
if down then // goto the next line
// do for all lines
loop
// show progress every 150 lines
if getrow > shownext then
say (getrow)
shownext = shownext + 150
end
// if this line is the same as the last line then delete it
if gettext == lasttext then
// delete line and test for end-of-file
if delline > getrow then
break
end
// ..otherwise save line text for the next comparision
// and goto the next line
else
lasttext = gettext
if not down then
break
end
end
end
end
undoend // end of undoable group
display // update display
// tell the user how many lines were removed
say (thousands oldsize - getlines) + " lines were removed"